//
//  Base_ViewController.m
//  International_Hospital
//
//  Created by LiYiLin on 16/7/4.
//  Copyright © 2016年 LiYiLin. All rights reserved.
//

#import "Base_ViewController.h"
//#import "UIViewController+JASidePanel.h"
//#import "JASidePanelController.h"

@interface Base_ViewController ()

@end

@implementation Base_ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setup_UI];
    [self setup_LeftButtonItem];
}

- (void)setup_UI {
    //DefineConstant.h 中宏定义颜色
    self.view.backgroundColor = WHITE_COLOR;
    //DefineConstant.h 中宏定义的主题颜色
    self.navigationController.navigationBar.barTintColor = kThemeColor;
}


- (void)setup_LeftButtonItem {
    
    //创建leftButton
    UIButton * left_Button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
    //左侧Item白色箭头样式
    [left_Button setImage:[UIImage imageNamed:@"JianTou"] forState:UIControlStateNormal];
    //为Item添加监听点击事件
    [left_Button addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside];
    //将设置好的leftBarButtonItem添加到右侧的Item上
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:left_Button];
}

//系统提供的方法,如果想跳转到任意的控制器 就重写goBack方法
- (void)goBack {
    [self.navigationController popViewControllerAnimated:YES];
}

#pragma mark - 中间指定的viewController
- (UINavigationController *)centerNavigationController {
    return (UINavigationController *)self.sidePanelController.centerPanel;
}
#pragma mark - 左侧的viewController
- (UIViewController *)leftViewController {
    return self.sidePanelController.leftPanel;
}
#pragma mark - 侧滑到指定的控制器中
- (void)jumpToOtherViewController:(UIViewController * )otherViewController {
    [self.sidePanelController showCenterPanelAnimated:YES];
    [[self centerNavigationController] pushViewController:otherViewController animated:NO];
}

@end









